package cn.com.enersun.iec61850.web.controller;


import cn.com.enersun.iec61850.web.util.FtpUtil;
import org.apache.commons.net.ftp.FTPFile;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by YYC on 2017/5/25.
 */
@RestController
@RequestMapping("/iec61850")
public class FtpController {

    @RequestMapping(value = "/listFtpFiles")
    public List<FTPFile> listFtpFiles() {
        FtpUtil ftpUtil=new FtpUtil();
        try {
            ftpUtil.connectServer();
            List<FTPFile> list = ftpUtil.listRemoteAllFiles("/");
            return list;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

}
